<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-table :data="rightlist" stripe border>
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="权限名称" prop="permission_name"></el-table-column>
        <el-table-column label="权限路径" prop="permission_url"></el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <el-tag type="primary" v-if="scope.row.permission_level === 0">一级</el-tag>
            <el-tag type="success" v-else>二级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import {getRightAPI} from '../../api/rightAPI'
export default {
  data(){
    return{
      rightlist: []
    }
  },
  mounted(){
    this.getRight()
  },
  methods:{
    async getRight(){
      let data = await getRightAPI()
      if (data.status !== 200) return this.$message.error('获取权限列表失败！')
      this.rightlist = data.data
    }
  }
}
</script>

<style>

</style>